// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

var allowedDates = new Array();

function isDisabled(date) {
	for(index in allowedDates) {
		if(((date.getMonth() < 10 ? "0" : "") + (date.getMonth() + 1)) + "/" + ((date.getDate()  < 10 ? "0" : "") + date.getDate()) + "/" + date.getFullYear() == allowedDates[index]) {
			return false;
		}
	}

	return true;
}

function showArchive(calendar) {
	if(calendar.dateClicked) {
		location = "/archives/" + calendar.date.getFullYear() + "/" + (calendar.date.getMonth() + 1) + "/" + calendar.date.getDate();
	}
}

window.onload = function() {
	Calendar.setup({
		date          : allowedDates.length > 0 ? Date.parse(allowedDates[0]) : new Date(),
		dateStatusFunc: isDisabled,
		flat          : "divCalendar",
		flatCallback  : showArchive,
		weekNumbers   : false
	});
}
